<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="nav" content="2" />
<meta name="acc" content="1-2" />
<title>添加请假记录</title>
<style type="text/css">
.pop_box {
	background-color: #cccccc;
	display: none;
	padding: 5px;
	position: fixed;
	width: 100%;
	height: 100%;
	z-index: 9999;
}
</style>
<%@ include file="/common/extjs.jsp"%>
<script type="text/javascript">
	$(document).ready(function() {
		var $testDialog = $("#pop").dialog({
			title:"资料上传",
			autoOpen : false,
			modal : true
		});
		$("#startdate").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '1900-10-01',
				dateFmt : 'yyyy-MM-dd '
			});
		});
		$("#enddate").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '#F{$dp.$D(\'startdate\')}',
				dateFmt : 'yyyy-MM-dd '
			});
		});
		$("#recorddate").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '1900-10-01',
				dateFmt : 'yyyy-MM-dd HH:mm:ss'
			});
		});
		$("#auditDate").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '#F{$dp.$D(\'recorddate\')}',
				dateFmt : 'yyyy-MM-dd HH:mm:ss'
			});
		});
		$("#verifyDate").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '1900-10-01',
				dateFmt : 'yyyy-MM-dd HH:mm:ss'
			});
		});
		$("#signDate").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '#F{$dp.$D(\'auditDate\')}',
				dateFmt : 'yyyy-MM-dd HH:mm:ss'
			});
		});
		$("#recordDate").addClass("Wate").bind("click", function() {
			WdatePicker({
				skin : 'whyGreen',
				minDate : '1900-10-01',
				dateFmt : 'yyyy-MM-dd HH:mm:ss'
			});
		});

		//为第一个文本框获得焦点
		$("#title").focus();
		//验证

		var $validate1 = $("#inputForm").validate({
			event : "blur",
			rules : {
				deptid : "required",
				userid : "required",
				startdate : "required",
				enddate : "required"
			}
		});

		$("#a_save").click(function() {
			$("#inputForm").attr("action", "${ctx}/human/leave!save1.action");
			$("#inputForm").submit();
			if ($validate1.numberOfInvalids()) {
			} else {
				$testDialog.dialog('open');
			}
		});
		
		$("#b_save").click(function() {
			$("#inputForm").submit();
			if ($validate1.numberOfInvalids()) {
			} else {
				$testDialog.dialog('open');
			}
		});

		$("#usern").click(function() {
			UserNameSelector.getView(function(a, c) {
				$("#usern").val(c);
				$("#userid").val(a);
			}, true).show();
		});
	});
</script>
</head>
<body>
	<div class="pop_box" id="pop">
		<h4>正在上传资料，请耐心等待···</h4>
	</div>
	<br>
	<form action="${ctx}/human/leave!save.action" method="post"
		id="inputForm" class='yform' enctype="multipart/form-data">
		<div id="caption">
			<h6>请假记录</h6>
		</div>
		<table class="noborder">
			<tr>
				<td>申请部门</td>
				<td><input id="id" name="id" type="hidden" value="${id }">
					<pt:labels type="insideOrgDept" name="deptid" prompt="全部"
						default="${deptid }"></pt:labels></td>
				<td>请(休)假人</td>
				<c:if test="${empty id }">
					<td><input type="text" name="usern" id="usern" class="choose"
						readonly="readonly"> <input id="userid" name="userid"
						type="hidden" value="${userid}" /></td>
				</c:if>
				<c:if test="${not empty id }">
					<td><input type="text" name="usern" id="usern"
						value='<pt:labels type="user" argument1="${userid }" single="true"></pt:labels>'
						class="choose" readonly="readonly"> <input id="userid"
						name="userid" type="hidden" value="${userid}" /></td>
				</c:if>
			</tr>
			<tr>
				<td>开始时间</td>
				<td><input id="startdate" name="startdate" type="text"
					value="${startdate }"></td>
				<td>结束时间</td>
				<td><input id="enddate" name="enddate" type="text"
					value="${enddate }"></td>
			</tr>
			<tr>
				<td>是否撤销</td>
				<td><pt:code category="1000" name="clear" default="${clear}"></pt:code></td>
				<td>请(休)假类型</td>
				<td><pt:code category="2030" name="type" default="${type}"></pt:code></td>
			</tr>
			<tr>
				<td>销假记录</td>
				<td><input id="recorder" name="recorder" type="text"
					value="${recorder }"></td>
				<td>销假时间</td>
				<td><input id="recordDate" name="recordDate" type="text"
					value="${recordDate }"></td>
			</tr>
			<tr>
				<td>附&nbsp;&nbsp;件</td>
				<td colspan="3"><input type="file" name="attachmention.upfile" />
				</td>
			</tr>
			<c:if test="${not empty attachment.id}">
				<tr id="attachment">
					<td>已有附件</td>
					<td colspan="3"><a title="下载"
						href="${ctx}/servlet/annex?id=${attachment.id}">${attachment.upfileFileName}</a>
						<span onclick="deleteAttachment('${attachment.id}')"
						class="delete" title="删除附件"></span></td>
				</tr>
			</c:if>
			<tr>
				<td>请假原因</td>
				<td colspan="3"><textarea rows="3" name="reason">${reason }</textarea>
				</td>
			</tr>
			<tr>
				<td>备&nbsp;&nbsp;注</td>
				<td colspan="3"><textarea name="remark" rows="3">${remark }</textarea></td>
			</tr>
		</table>
		<table>
			<tr>
				<td colspan="4">年休假: <input type="text" value="去年"
					style="width: 50px; border: 0px">剩年休假<input
					id="vacationCount" name="vacationCount" value="${vacationCount }"
					type="text" style="width: 50px; border: 0px">天, 现休<input
					id="vacationRemain" name="vacationRemain" type="text"
					value="${vacationRemain }" style="width: 50px; border: 0px">天

				</td>
			</tr>
			<tr>
				<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
					type="text" value="今年" style="width: 50px; border: 0px">应有年休假<input
					id="vacationCount2" name="vacationCount2" type="text"
					value="${vacationCount2 }" style="width: 50px; border: 0px">天,剩
					<input id="vacationAdjust" name="vacationAdjust" type="text"
					value="${vacationAdjust }" style="width: 50px; border: 0px">天,
					现休<input id="vacationRemain2" name="vacationRemain2" type="text"
					value="${vacationRemain2 }" style="width: 50px; border: 0px">天
				</td>
			</tr>
			<tr>
				<td colspan="4">换休假: <input type="text" value="今年"
					style="width: 50px; border: 0px">应有换休假<input
					id="overtimeCount" name="overtimeCount" type="text"
					value="${overtimeCount }" style="width: 50px; border: 0px">天,已调
					<input id="overtimeRemain " name="overtimeRemain " type="text"
					value="${overtimeRemain  }" style="width: 50px; border: 0px">天,本次调
					<input id="overtimeAdjust " name="overtimeAdjust " type="text"
					value="${overtimeAdjust  }" style="width: 50px; border: 0px">天
				</td>
			</tr>
			<tr>
				<td>其&nbsp;&nbsp;他:<input id="other" name="other" type="text"
					value="${other }">
				</td>
			</tr>
		</table>
		<div class="type-button">
			<c:if test="${empty status }">
				<input type="button" class="submit" id="b_save" value="暂存">
				<input type="button" id="a_save" value="提交"
					onclick="return isProcess();">
			</c:if>
			<input type="button" class="reset" onclick="history.back()"
				value="返回">
		</div>
	</form>
</body>
</html>